<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="sf" uri="http://www.sf-express.com/tags" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/li/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改运营用户</title>
<style type="text/css">
.error{
	display:inline;
	color:red;
	font-family:黑体;
	font-size: 12px;
}

.error2{
	color:red;
	font-family:黑体;
	font-size: 12px;
}

.checkboxLabel{
	display:inline;
	font-size: 18px;

}
</style>
<script type="text/javascript">
sfAutoEmail.email({
	mailList:["@xiaoniu66.com"]
});
	function check(){
		$("#modifyButton").attr("disabled","disabled");
		$("#userForm").ajaxSubmit(function(data){
			$("#gridTable").trigger("reloadGrid", [{page:1}]);
			 myDialog.close();
	       	 myDialog =  art.dialog({icon: data.success,content: data.message,lock:true});
		});
	}

	$(function(){
		$("#userForm").validator({validInHidden:true},{
			callback:function(results){
				check();
			}
		});
	});
	
</script>
</head>
<body>
			<form id="userForm" method="post" action="user/modify">
			<sf:token id="user_modify"/>
			<input id="id" name="id" type="hidden" value="<c:out value="${id}"/>"/>
			<input id="source" name="source" type="hidden" value="<c:out value="${source}"/>"/>
			<input type="hidden" id="duty" name="duty" value="0"/>
				<ul class="all_list">
				<!-- <div id="errorMsg" style="color: red;"> -->
				<c:out value="${msg}"></c:out>
				<br/>
						<li>
							<span class="all_title">用户名：</span>
							<span><label name="userName"><c:out value="${userName}"/></label>
								<input id="userName" name="userName" type="hidden" value="<c:out value="${userName}"/>"/>
							</span>
						</li>
						<li>
							<span class="all_title">真实姓名：</span>
							<span><input id="realName" type="text" class="ui_input" value="<c:out value="${realName}"/>"
								name="realName" validator='{"label":"真实姓名","maxLength":30}'/>
							</span>
						</li>
						<li>
							<span class="all_title">联系电话：</span>
							<span><input id="telephone" type="text" class="ui_input" value="<c:out value="${telephone}"/>"
								name="telephone" validator='{"label":"联系电话","txtType":"phone","maxLength":15}'/>
							</span>
						</li>
						<li>
							<span class="all_title">邮箱：</span>
							<span><input id="email" type="text" class="ui_input fn-email" value="<c:out value="${email}"/>" name="email"
							 validator='{"label":"邮箱","txtType":"xn-email","maxLength":50}'/>
							</span>
							<br/><span class="all_title"></span><span>（请使用顺丰邮箱，如:XXX@sf-express.com；密码将以邮件形式发送到此邮箱）</span>
						</li>
				<!-- 		<li><span class="all_title">权限卡绑定：</span>
							<span>
								<input type="radio" name="authMethod" id="authMethod1" value="1"  checked="checked" onclick="setAuthMethod(this.value)"/><label for="authMethod1">使用权限卡</label>&nbsp;&nbsp; 
								<input type="radio" name="authMethod" id="authMethod2" value="0" onclick="setAuthMethod(this.value)"/><label for="authMethod2">不使用权限卡</label> &nbsp;&nbsp;（登录顺丰支付运营系统时是否需要权限卡）
							</span>
						</li> -->
						<!-- <li hidden="true"><span class="all_title">所属机构：</span>
						 <span><input id="department" type="text"
							value="SFPAY" name="department"
							class="ui_input" validator='{"label":"所属机构","maxLength":20}'/>
						</span>
					</li> --><input type="hidden" id="orgId" name="orgId" value="<c:out value="${orgId}"/>"/>
								<input type="hidden" id="orgName" name="orgName"  value="<c:out value="${orgName}"/>"/>
							<input type="hidden" id="department" name="department" value="<c:out value="${department}"/>"/>
						<%-- <li>
							<span class="all_title">用户角色：</span>
							<span ><c:forEach var="role" items="${roleList}"
									varStatus="status">
										<input name="roleList" id="<c:out value="${role.id}"/>" type="checkbox" value="<c:out value="${role.id}"/>" />
										<label for="<c:out value="${role.id}"/>" style="display:inline;"><c:out value="${role.name}"/></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
								</c:forEach>
								<span id="errorRole" class="error2">*</span>
							</span>
						</li> --%>
						<li>
							<span class="all_title">备注：</span>
							<span><textarea id="remark"  name="remark" style="width: 163px; height: 84px;" validator='{"label":"备注","required":false,"maxLength":500}'><c:out value="${remark}"/></textarea></span>
						</li>
						<li>
							<span class="all_title"></span>
							<span><input type="button" id="modifyButton" class="edit_btn submitBtn" name="modifyButton" value="修改">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<shiro:hasPermission name="user:reset"><input id="password" type="button" class="btn_blue" value="重置密码" name="password" onclick="resetPwd()"></shiro:hasPermission>
							</span>
						</li>
						</li>
						</ul>
			</form>
			<c:forEach var="role" items="${myRoleList}">
				<input name="myRoleList" type="hidden" value="<c:out value="${role.id}"/>" />
			</c:forEach>
<script type="text/javascript">
	/* $('input[name="myRoleList"]').each(function(index){
		  $('#'+this.value).attr("checked",true);
	}); 
	 */
	
	function resetPwd(){
		var userName=$('#userName').attr("value");
		$.ajax({
			url:CONTEXT_PATH+"/user/reset_pwd/"+userName+"?&rand="+Math.random(),
			type:'POST',
			data:'userName='+userName,
			success:function(data){
				if(data == "1"){
					art.dialog({icon:'succeed',content: "密码重置成功！",lock:true});
				}
				else if(data == "0"){
					art.dialog({id:"msg",icon:'error',content: "密码重置失败！",lock:true});
				}
			}
		});
	}
	
	function setAuthMethod(method){
		if(method=="0"){
			$('#cardIdbound').hide();
			$('#cardId').attr("value",1);
		}else if(method=="1"){
			$('#cardIdbound').show();
			if($('#cardId').attr("value")=="1"){
				$('#cardId').attr("value","");
			}
		}
	}
	
	/* $("#red_card").click(function(){
		$("#cardId1").focus();
	}); */
</script>
</body>
</html>